(library (lib print-utils)
  (export debug print println)
  (import
   (except (rnrs base) let-values map)
   (only (guile)
         lambda* λ
         map
         ;; printing
         display
         simple-format
         current-output-port
         ;; strings
         string-join
         ;; control flow
         when))

  (define thing->string
    (λ (thing)
      (simple-format #f "~a" thing)))

  (define print
    (lambda* (#:key
              (output-port (current-output-port))
              (sep " ")
              (end "\n")
              . msgs)
      (simple-format
       output-port "~a"
       (string-append (string-join (map thing->string msgs) sep) end)))))
